﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MensUnoShop.Areas.Admin.Models;

namespace MensUnoShop.Areas.Admin.Controllers
{
    public class DefaultController : Controller
    {
        //
        // GET: /Admin/Default/

        public ActionResult Index()
        {
            return RedirectToAction("Login");
        }

        public ActionResult Login()
        {
            return View();
        }

        public ActionResult Logout()
        {
            Session["ma"] = null;
            return RedirectToAction("Index");
        }

        [HttpPost]
        public ActionResult Login(string user, string pwd, string returnUrl)
        {
            Manager m = new Manager();
            if (m.Check(user, pwd))
                m.SaveCookies();
            if (!string.IsNullOrEmpty(returnUrl))
                return Redirect(returnUrl);
            else
                return Redirect("/Admin/OrderManagement/OrderListWaiting?page=0");
        }

    }
}
